package com.xiaoluo.lottery.common.weixin.utils;

import java.util.Properties;

/**
 * User: rizenguo
 * Date: 2014/10/29
 * Time: 14:40
 * 这里放置各种配置数据
 */
public class Configure {
	//这个就是自己要保管好的私有Key了（切记只能放在自己的后台代码里，不能放在任何可能被看到源代码的客户端程序中）
	// 每次自己Post数据给API的时候都要用这个key来对所有字段进行签名，生成的签名会放在Sign这个字段，API收到Post数据的时候也会用同样的签名算法对Post过来的数据进行签名和验证
	// 收到API的返回的时候也要用这个key来对返回的数据算下签名，跟API的Sign数据进行比较，如果值不一致，有可能数据被第三方给篡改

	private static String key = "8710jfod8902jkkd09i2ejcdj89i290u";//

	//微信分配的公众号ID（开通公众号之后可以获取到）
	private static String appID = "wx7c6a7bf8b5dcf4e4";

	//微信支付分配的商户号ID（开通公众号的微信支付功能之后可以获取到）
	private static String mchID = "1227867502";

	//HTTPS证书的本地路径
	private static String certLocalPath = "";

	//HTTPS证书密码，默认密码等于商户号MCHID
	private static String certPassword = "1227867502";

	//是否使用异步线程的方式来上报API测速，默认为异步模式
	private static boolean useThreadToDoReport = true;

	private static String payNotifyUrl = "http://www.xiaoluo.com/lottery/pay/notify";

	public static String SEND_NAME = "小螺趣租";
	public static String WISHING = "恭喜您";
	public static String ACT_NAME = "夺宝活动";
	public static String HB_REMARK = "参与越多中得越多，快来抢！";

	private static int playerOnlineTimeOutSec=1200;
	//Wishing

	//setSend_name


	//机器IP
	private static String ip = "119.139.137.43";

	private static String MCHT = "MCHT";

	/**
	 *
	 * @param sysProperties
	 */
	public static void initialize(Properties sysProperties){
		key = sysProperties.getProperty("wx.app.key") != null?sysProperties.getProperty("wx.app.key"):key;
		appID = sysProperties.getProperty("wx.app.appID") != null?sysProperties.getProperty("wx.app.appID"):appID;
		mchID = sysProperties.getProperty("wx.mchID") != null?sysProperties.getProperty("wx.mchID"):mchID;
		certLocalPath = sysProperties.getProperty("wx.certLocalPath") != null?sysProperties.getProperty("wx.certLocalPath"):certLocalPath;
		certPassword = sysProperties.getProperty("wx.certPassword") != null?sysProperties.getProperty("wx.certPassword"):certPassword;
		payNotifyUrl = sysProperties.getProperty("wx.pay.notifyUrl") != null?sysProperties.getProperty("wx.pay.notifyUrl"):payNotifyUrl;
		playerOnlineTimeOutSec=Integer.parseInt(sysProperties.getProperty("player.online.timeout.s"));
	}

	public static String getMCHT() {
		return MCHT;
	}

	public static String getPayNotifyUrl() {
		return payNotifyUrl;
	}

	public static boolean isUseThreadToDoReport() {
		return useThreadToDoReport;
	}

	public static void setUseThreadToDoReport(boolean useThreadToDoReport) {
		Configure.useThreadToDoReport = useThreadToDoReport;
	}

	public static String HttpsRequestClassName = "com.tencent.common.HttpsRequest";

	public static void setKey(String key) {
		Configure.key = key;
	}

	public static void setAppID(String appID) {
		Configure.appID = appID;
	}

	public static void setMchID(String mchID) {
		Configure.mchID = mchID;
	}


	public static void setCertLocalPath(String certLocalPath) {
		Configure.certLocalPath = certLocalPath;
	}

	public static void setCertPassword(String certPassword) {
		Configure.certPassword = certPassword;
	}

	public static void setIp(String ip) {
		Configure.ip = ip;
	}

	public static String getKey(){
		return key;
	}
	
	public static String getAppid(){
		return appID;
	}
	
	public static String getMchid(){
		return mchID;
	}

	public static String getCertLocalPath(){
		return certLocalPath;
	}
	
	public static String getCertPassword(){
		return certPassword;
	}

	public static String getIP(){
		return ip;
	}

	public static void setHttpsRequestClassName(String name){
		HttpsRequestClassName = name;
	}



}
